package com.sanmubird.mywebframework.eventbus.demo.direct;

import com.sanmubird.mywebframework.eventbus.core.MqExchangeEnum;
import com.sanmubird.mywebframework.eventbus.core.MqMessage;
import com.sanmubird.mywebframework.eventbus.core.MqObserver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class DemoDirectObserver2 implements MqObserver<DemoDirectData> {

    private static final Logger LOGGER = LoggerFactory.getLogger(DemoDirectObserver2.class);

    @Override
    public void observe(MqMessage<DemoDirectData> mqMessage) {
        LOGGER.info(this.getClass().getSimpleName());
        DemoDirectData data = mqMessage.getData();
        int i = 1 / 0;
        LOGGER.info(data.getValue());
    }

    @Override
    public String getRoutingKey() {
        return MqExchangeEnum.DEMO_DIRECT_EXCHANGE.getRoutingKey();
    }
}
